
R version 3.1.0 (2014-04-10) -- "Spring Dance"
Copyright (C) 2014 The R Foundation for Statistical Computing
Platform: x86_64-unknown-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> set.seed(51)
> 
> load(file="~/PM10/pm10_withps1990.Rda")
> 
> ######## Prune observations that are out of range ###########
> dat=subset(dat, outofrange==0)
> dat$pscat = as.factor(dat$pscat)
> 
> ######## Set the Working Directory so that output is saved in the right place ######## 
> wd <- "~/PM10/20150502_pollution_big_1990/"
> setwd(wd)
> 
> ##############################################################
> ################ Specify the Array Parameters ################
> ##############################################################
> ytrans = c("log", "change", "95") 
> 
> ##############################################################
> ###################### Array Starts Here #####################
> ##############################################################
> j = as.numeric(Sys.getenv('SLURM_ARRAY_TASK_ID'))
> print(j)
[1] 3
> 
> 
> library(splines)
> library(HEIfunctions)
> library(coda)
Loading required package: lattice
> library(corpcor)
> 
> ######## Choose how to transform pollution ######## 
> if (ytrans[j]=="log")
+   dat$y = log(dat$pm10fu)   
> if (ytrans[j]=="change")
+   dat$y = dat$pm10fu - dat$pm10base1990
> if (ytrans[j]=="95")
+   dat$y = log(dat$pm10fu95)
> 
> 
> 
> ######## Choose how to specify the model ######## 
> ### Big Models ###
> vars = c("Monitor", "a", "Median_income", "HS_rate", "Urban_rate", "Migration_5_year_rate", "Hispanic_cens", "White_cens", "Black_cens",
+          "Current_Smoking_rate_weighted", "Female_cens", "mean_age.2001", "Female_rate.2001", "White_rate.2001", "Black_rate.2001",
+          "Tot_Beneficiary.2001", "pm10base1990", "housedens", "temperature", "logpop")
> ## Use all the variables listed above except the census ones that are duplciated in medicare
> my=glm(y~pscat + pm10base1990 + Tot_Beneficiary.2001 + Median_income + HS_rate + Urban_rate + Migration_5_year_rate + Current_Smoking_rate_weighted + mean_age.2001 + Female_rate.2001 + White_rate.2001 + Black_rate.2001 + housedens + temperature + logpop, 
+        data=dat)
> formula = my$formula
> 
> coords 	<- cbind(dat$Longitude, dat$Latitude)
> 
> phistart 	<- makephi(coords, 10)
> philower 	<- makephi(coords, 4)
> phiupper 	<- makephi(coords, 30)
> 
> tuning 	<- list(A = 0.1, psi = 0.2, theta = 1)
> prior 		<- list(KIG = rep(.5,2), psi = rep(.5,2), theta1 = rep(philower, 2), theta2 = rep(phiupper,2))
> starting 	<- list(B=NULL, A = NULL, psi = NULL, theta = phistart)
> 
> mod 		<- mvpsmod(formula, dat, "a", coords, nsamp=50000, thin=1,
+ 			tuning=tuning, prior=prior, starting=starting, 
+       outputbinsize = 500, outputfilename = paste("pollutionmodel_temp_", ytrans[j],".Rda", sep=""))
Loading required package: spBayes
Loading required package: magic
Loading required package: abind
Loading required package: Formula
Loading required package: MASS
[1] "Note: function does not accept missing data in covariates."
[1] "Iteration: 1000"
[1] "Accepted:" "0.328"     "0.319"     "0.328"     "0.319"     "0.328"    
[7] "0.319"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 2000"
[1] "Accepted:" "0.318"     "0.321"     "0.318"     "0.321"     "0.318"    
[7] "0.321"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 3000"
[1] "Accepted:" "0.309"     "0.317"     "0.309"     "0.317"     "0.309"    
[7] "0.317"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 4000"
[1] "Accepted:" "0.308"     "0.32"      "0.308"     "0.32"      "0.308"    
[7] "0.32"     
[1] "Number of not PD:" "0"                
[1] "Iteration: 5000"
[1] "Accepted:" "0.304"     "0.315"     "0.304"     "0.315"     "0.304"    
[7] "0.315"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 6000"
[1] "Accepted:" "0.3"       "0.315"     "0.3"       "0.315"     "0.3"      
[7] "0.315"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 7000"
[1] "Accepted:" "0.305"     "0.319"     "0.305"     "0.319"     "0.305"    
[7] "0.319"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 8000"
[1] "Accepted:" "0.304"     "0.317"     "0.304"     "0.317"     "0.304"    
[7] "0.317"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 9000"
[1] "Accepted:" "0.303"     "0.314"     "0.303"     "0.314"     "0.303"    
[7] "0.314"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 10000"
[1] "Accepted:" "0.305"     "0.315"     "0.305"     "0.315"     "0.305"    
[7] "0.315"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 11000"
[1] "Accepted:" "0.303"     "0.314"     "0.303"     "0.314"     "0.303"    
[7] "0.314"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 12000"
[1] "Accepted:" "0.304"     "0.314"     "0.304"     "0.314"     "0.304"    
[7] "0.314"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 13000"
[1] "Accepted:" "0.305"     "0.316"     "0.305"     "0.316"     "0.305"    
[7] "0.316"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 14000"
[1] "Accepted:" "0.304"     "0.314"     "0.304"     "0.314"     "0.304"    
[7] "0.314"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 15000"
[1] "Accepted:" "0.303"     "0.313"     "0.303"     "0.313"     "0.303"    
[7] "0.313"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 16000"
[1] "Accepted:" "0.305"     "0.313"     "0.305"     "0.313"     "0.305"    
[7] "0.313"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 17000"
[1] "Accepted:" "0.304"     "0.314"     "0.304"     "0.314"     "0.304"    
[7] "0.314"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 18000"
[1] "Accepted:" "0.303"     "0.314"     "0.303"     "0.314"     "0.303"    
[7] "0.314"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 19000"
[1] "Accepted:" "0.303"     "0.315"     "0.303"     "0.315"     "0.303"    
[7] "0.315"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 20000"
[1] "Accepted:" "0.303"     "0.315"     "0.303"     "0.315"     "0.303"    
[7] "0.315"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 21000"
[1] "Accepted:" "0.303"     "0.315"     "0.303"     "0.315"     "0.303"    
[7] "0.315"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 22000"
[1] "Accepted:" "0.304"     "0.315"     "0.304"     "0.315"     "0.304"    
[7] "0.315"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 23000"
[1] "Accepted:" "0.302"     "0.315"     "0.302"     "0.315"     "0.302"    
[7] "0.315"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 24000"
[1] "Accepted:" "0.303"     "0.314"     "0.303"     "0.314"     "0.303"    
[7] "0.314"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 25000"
[1] "Accepted:" "0.303"     "0.315"     "0.303"     "0.315"     "0.303"    
[7] "0.315"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 26000"
[1] "Accepted:" "0.303"     "0.315"     "0.303"     "0.315"     "0.303"    
[7] "0.315"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 27000"
[1] "Accepted:" "0.303"     "0.314"     "0.303"     "0.314"     "0.303"    
[7] "0.314"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 28000"
[1] "Accepted:" "0.304"     "0.314"     "0.304"     "0.314"     "0.304"    
[7] "0.314"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 29000"
[1] "Accepted:" "0.303"     "0.313"     "0.303"     "0.313"     "0.303"    
[7] "0.313"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 30000"
[1] "Accepted:" "0.302"     "0.312"     "0.302"     "0.312"     "0.302"    
[7] "0.312"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 31000"
[1] "Accepted:" "0.302"     "0.312"     "0.302"     "0.312"     "0.302"    
[7] "0.312"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 32000"
[1] "Accepted:" "0.302"     "0.311"     "0.302"     "0.311"     "0.302"    
[7] "0.311"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 33000"
[1] "Accepted:" "0.301"     "0.311"     "0.301"     "0.311"     "0.301"    
[7] "0.311"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 34000"
[1] "Accepted:" "0.301"     "0.311"     "0.301"     "0.311"     "0.301"    
[7] "0.311"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 35000"
[1] "Accepted:" "0.302"     "0.311"     "0.302"     "0.311"     "0.302"    
[7] "0.311"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 36000"
[1] "Accepted:" "0.302"     "0.311"     "0.302"     "0.311"     "0.302"    
[7] "0.311"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 37000"
[1] "Accepted:" "0.302"     "0.312"     "0.302"     "0.312"     "0.302"    
[7] "0.312"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 38000"
[1] "Accepted:" "0.302"     "0.311"     "0.302"     "0.311"     "0.302"    
[7] "0.311"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 39000"
[1] "Accepted:" "0.303"     "0.312"     "0.303"     "0.312"     "0.303"    
[7] "0.312"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 40000"
[1] "Accepted:" "0.303"     "0.312"     "0.303"     "0.312"     "0.303"    
[7] "0.312"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 41000"
[1] "Accepted:" "0.303"     "0.312"     "0.303"     "0.312"     "0.303"    
[7] "0.312"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 42000"
[1] "Accepted:" "0.303"     "0.312"     "0.303"     "0.312"     "0.303"    
[7] "0.312"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 43000"
[1] "Accepted:" "0.303"     "0.311"     "0.303"     "0.311"     "0.303"    
[7] "0.311"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 44000"
[1] "Accepted:" "0.303"     "0.311"     "0.303"     "0.311"     "0.303"    
[7] "0.311"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 45000"
[1] "Accepted:" "0.303"     "0.311"     "0.303"     "0.311"     "0.303"    
[7] "0.311"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 46000"
[1] "Accepted:" "0.303"     "0.311"     "0.303"     "0.311"     "0.303"    
[7] "0.311"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 47000"
[1] "Accepted:" "0.304"     "0.311"     "0.304"     "0.311"     "0.304"    
[7] "0.311"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 48000"
[1] "Accepted:" "0.304"     "0.31"      "0.304"     "0.31"      "0.304"    
[7] "0.31"     
[1] "Number of not PD:" "0"                
[1] "Iteration: 49000"
[1] "Accepted:" "0.304"     "0.31"      "0.304"     "0.31"      "0.304"    
[7] "0.31"     
[1] "Number of not PD:" "0"                
[1] "Iteration: 50000"
[1] "Accepted:" "0.304"     "0.311"     "0.304"     "0.311"     "0.304"    
[7] "0.311"    
[1] "Number of not PD:" "0"                
> 
> save(mod, file = paste("pollutionmod_", ytrans[j], ".Rda", sep=""))
> 
> 
> 
> 
> 
> 
> proc.time()
      user     system    elapsed 
271465.324     69.155 272104.372 
